# -*- coding: utf-8 -*-
# @Time    :2021/2/6 15:25
# @Author  :robot_zsj
# @File    :Helper.py.py
from flask import jsonify, g, render_template

def ops_render( template, context = {} ):
    if 'current_user' in g:
        context['current_user'] = g.current_user
    return render_template( template, **context )


def ops_renderJSON(code=200, msg="操作成功~~", data={}):
    resp = {"code": code, "msg": msg, "data": data}
    return jsonify(resp)


def ops_renderErrJSON(msg="系统繁忙，请稍后再试~~", data={}):
    return ops_renderJSON(code=-1, msg=msg, data=data)
